<?php
/**
 * 体征应测量次数和已测量次数
 * Created by PhpStorm.
 * User: zhang-hong
 * Date: 2017/3/8
 * Time: 14:27
 */
class GetfarebingrentingzhengController extends Yaf_Controller_Abstract
{
    function IndexAction()
    {
        $request = $this->getRequest();
        $zhuyuan_id = $request->getPost("zhuyuan_id",0);
        $yiyuan_id = $request->getPost("yiyuan_id",0);
        //$zhuyuan_id = strip_tags($_REQUEST['zhuyuan_id']);
        //$yiyuan_id = strip_tags($_REQUEST['yiyuan_id']);
        $zhuyuanfarelevelModel = new ZhuyuanFareLevelModel();
        if($zhuyuan_id == "" || $yiyuan_id == "")
        {
            Utility::apiJsonError(20015, '患者信息有误');
        }
        if(!ctype_digit("$yiyuan_id"))
        {
            Utility::apiJsonError(20027, '医院ID必须是整型');
        }

        $times = $zhuyuanfarelevelModel->GetZhuyuanFareLeveData($zhuyuan_id,$yiyuan_id);
        $shuhou = $zhuyuanfarelevelModel->GatZhuyuanTizheng($zhuyuan_id,$yiyuan_id);
        if($shuhou != ""){
            $shuhou = str_replace(array('年','月','日'), array('-','-',''), $shuhou);
            $shuhou = $zhuyuanfarelevelModel->zpd_date_diff($shuhou);
        }
        $has_times = $zhuyuanfarelevelModel->get_has_times($zhuyuan_id,$yiyuan_id);
        $data = [
            'error' => 200,
            'msg' => "",
            'yingce_cishu' => $times ? :0,
            'yice_cishu' => $has_times,
            'shuhou'=>$shuhou
        ];
        //$compression_http_data = $_REQUEST["compression_http_data"];
        //Utility::apiJsonResult($data,"",$compression_http_data);
        Utility::apiJsonResultExtends($data);
    }
}